Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <script src="loadxmldoc.js"> </script> </head> <body> <script> xmlDoc=loadXMLDoc("books.xml"); document.write("Nodename: " + xmlDoc.nodeName); document.write(" (nodetype: " + xmlDoc.nodeType + ")<br>"); x=xmlDoc.documentElement; document.write("Nodename: " + x.nodeName); document.write(" (nodetype: " + x.nodeType + ")<br>"); y=x.childNodes; for (i=0;i<y.length;i++) { document.write("Nodename: " + y[i].nodeName); document.write(" (nodetype: " + y[i].nodeType + ")<br>"); for (z=0;z<y[i].childNodes.length;z++) { document.write("Nodename: " + y[i].childNodes[z].nodeName); document.write(" (nodetype: " + y[i].childNodes[z].nodeType + ")<br>"); } } </script> </body> <!-- Mirrored from www.w3schools.com/dom/tryit.asp?filename=try_dom_nodetype by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:19:39 GMT --> </html>
Result:
Try it Yourself - © w3schools.com